#include "stdafx.h"
#include "RSRegister.h"
#include "RSSettingsDlg.h"

static RSSettingsDlg *nowRSSettingsDlgPtr;

RSSettingsDlg::RSSettingsDlg(HINSTANCE hInst, HWND hwnd)
{
	ParentInstance = hInst;
	parentWnd = hwnd;
	FModalResult = NULL;
}

RSSettingsDlg::~RSSettingsDlg(void)
{

}

void RSSettingsDlg::ShowModal()
{
	RSSettingsDlg *tmp = nowRSSettingsDlgPtr;
	nowRSSettingsDlgPtr = this;
	DialogBox(ParentInstance, MAKEINTRESOURCE(IDD_SETTINGS), parentWnd, WindowProc);
	nowRSSettingsDlgPtr = tmp;
};

INT_PTR CALLBACK RSSettingsDlg::WindowProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);

	switch (message)
	{
		case WM_INITDIALOG:
			nowRSSettingsDlgPtr->OnCreateDlg();
			return (INT_PTR)TRUE;

		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
				case IDOK:
					nowRSSettingsDlgPtr->OnOkClick(hDlg, message, wParam, lParam);
					return (INT_PTR)TRUE;

				case IDCANCEL:
					nowRSSettingsDlgPtr->OnCancelClick(hDlg, message, wParam, lParam);
					return (INT_PTR)TRUE;
			};
			break;
	};
	return (INT_PTR)FALSE;
};

void RSSettingsDlg::OnOkClick(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	FModalResult = IDOK;
	EndDialog(hDlg, LOWORD(wParam));
};

void RSSettingsDlg::OnCancelClick(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	FModalResult = IDCANCEL;
	EndDialog(hDlg, LOWORD(wParam));
};

void RSSettingsDlg::OnCreateDlg()
{
	int a = 5;
	a++;
};